namespace TimeMachine.Engine.Metrics.Impl
{
	public class SumPerDay : IAggregator
	{
		private double sum;

		public void StartNewPeriod()
		{
			sum = 0;
		}

		public void Aggregate(double value)
		{
			sum += value;
		}

		public double GetResult(double aggregationPeriodInDays)
		{
			if(aggregationPeriodInDays == 0) return 0;
			return sum/aggregationPeriodInDays;
		}
	}
}